<template lang="html">
  <a-layout class="mailbox table" style="background: #f0f0f0;">
    <div class="table__left">
      <div class="table-list">
        <div class="list__title" v-html="listDataA.title"></div>
        <a class="ask" @click="goMail">我要问政 |</a>
        <a class="more" @click="golist(listDataA, 'Advisory')">更多 <a-icon type="double-right" /></a>
        <ul class="list__content">
          <li class="list__content-item" v-for="item in listDataA.data" @click="goDetail(item, listDataA)">
            <div class="item__title" v-html="titleHandeler(item)"></div>
            <div class="item__date" v-html="item.FDate"></div>
          </li>
        </ul>
      </div>
    </div>
    <div class="table__right">
      <div class="table-list" style="flex: 1;">
        <div class="list__title" v-html="listDataB.title"></div>
        <a class="ask" @click="goMail">我要建议 |</a>
        <a class="more" @click="golist(listDataB, 'Suggest')">更多 <a-icon type="double-right" /></a>
        <ul class="list__content">
          <li class="list__content-item" v-for="item in listDataB.data" @click="goDetail(item, listDataB)">
            <div class="item__title" v-html="titleHandeler(item)"></div>
            <div class="item__date" v-html="item.FDate"></div>
          </li>
        </ul>
      </div>
      <div class="table-list" style="flex: 1;">
        <div class="list__title" v-html="listDataC.title"></div>
        <a class="ask" @click="goMail">我要投诉 |</a>
        <a class="more" @click="golist(listDataC, 'Complaint')">更多 <a-icon type="double-right" /></a>
        <ul class="list__content">
          <li class="list__content-item" v-for="item in listDataC.data" @click="goDetail(item, listDataC)">
            <div class="item__title" v-html="titleHandeler(item)"></div>
            <div class="item__date" v-html="item.FDate"></div>
          </li>
        </ul>
      </div>
    </div>
  </a-layout>
</template>

<script>
import {invoke} from "@/api";
export default {
  data () {
    return {
      parentTitle: "局长信箱",
      parentURL: "/mailbox",
      listDataA: {
        title: "网民问政",
        url: "api/WTM.NetizenAsking.perpareNotCheckEdit",
        pageCode: "WTM.NetizenAsking.Edit",
        data: []
      },
      listDataB: {
        title: "群众建议",
        url: "api/WTM.NetizenAsking.perpareNotCheckEdit",
        pageCode: "WTM.NetizenAsking.Edit",
        data: []
      },
      listDataC: {
        title: "我要投诉",
        url: "api/WTM.NetizenAsking.perpareNotCheckEdit",
        pageCode: "WTM.NetizenAsking.Edit",
        data: []
      }
    }
  },
  mounted() {
    this.loadData()
  },
  methods: {
    loadData() {
      invoke("api/WTM.NetizenAsking.getNotCheckList.vdt", {
        pageCode: "WTM.NetizenAsking.List",
        pageSize: 9,
        type: "Advisory"
      }).then((res) => {
        this.listDataA.data = []
        this.listDataA.data = res.records
      })
      invoke("api/WTM.NetizenAsking.getNotCheckList.vdt", {
        pageCode: "WTM.NetizenAsking.List",
        pageSize: 4,
        type: "Suggest"
      }).then((res) => {
        this.listDataB.data = []
        this.listDataB.data = res.records
      })
      invoke("api/WTM.NetizenAsking.getNotCheckList.vdt", {
        pageCode: "WTM.NetizenAsking.List",
        pageSize: 4,
        type: "Complaint"
      }).then((res) => {
        this.listDataC.data = []
        this.listDataC.data = res.records
      })
    },
    goDetail(item, list) {
      this.$router.push({
        path: '/info-page',
        query: {
          FId: item.FId,
          parentTitle: this.parentTitle,
          parentURL: this.parentURL,
          FTitle: list.title,
          url: "api/WTM.NetizenAsking.perpareNotCheckEdit.vdt",
          pageCode: "WTM.NetizenAsking.Edit",
          listURL: list.url,
          listPageCode: list.pageCode
        }
      })
    },
    goMail () {
      this.$router.push({
        path: "/mail"
      })
    },
    titleHandeler(item) {
      return `【${item.FLetterStatus}】 ${item.FTitle}`
    },
    golist(list, type) {
      this.$router.push({
        path: "/list-page",
        query: {
          parentTitle: this.parentTitle,
          parentURL: this.parentURL,
          FTitle: list.title,
          url: list.url,
          pageCode: list.pageCode,
          listURL: list.url,
          listPageCode: list.pageCode,
          type: type
        }
      })
    }
  }
}
</script>

<style lang="scss">
</style>
